import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'calendar_today_bloc.dart';
import 'calendar_today_event.dart';
import 'calendar_today_state.dart';

class CalendarTodayPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return BlocProvider(
      create: (BuildContext context) => CalendarTodayBloc()..add(InitEvent()),
      child: Builder(builder: (context) => _buildPage(context)),
    );
  }

  Widget _buildPage(BuildContext context) {
    final bloc = BlocProvider.of<CalendarTodayBloc>(context);
    return BlocBuilder<CalendarTodayBloc, CalendarTodayState>(
        bloc: bloc,
        builder: (_, CalendarTodayState state) {
          return Center(child: Text("${state.model.result?.data?.animalsYear}"),);
        }
    );
  }
}

